mirror of
https://github.com/lm-sensors/lm-sensors.git
synced 2026-11-07 16:01:34 +00:00
Update to the latest (mod-19990118) kernel archive
I really hope I did not forget an add or remove. If strange things happen when you compile, please let me know. There may still be problems with the EXPORT_* stuff; it seems to work now for kernel 2.0.36pre19, but it may give trouble for earlier kernels. We need to check that. Some i2c modules may be a bit verbose at this moment. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@184 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
1 parent
a9ed098e1a
commit
634cb32ac0
18 files changed
+62
-264
No files matched your search
+2
-21
@@ -7,6 +7,8 @@ of the i2c code and not compile the version in here.
|
||||
be applied! If there are changes like this in this list, you *must*
|
||||
use our version of the i2c module!
|
||||
|
||||
The current version of Simon's code is called mod-19990118.tar.gz.
|
||||
|
||||
Here come the changes:
|
||||
|
||||
* EXPORT_SYMBOL declarations put between #ifdef statements
|
||||
@@ -15,14 +17,6 @@ Here come the changes:
|
||||
influence on the resulting object code; a few more functions may be
|
||||
exported, but this should do no harm.
|
||||
|
||||
* bit-mb.c: Linux 2.0.x fixes
|
||||
Some small changes to make this file compile with 2.0 kernels. These
|
||||
changes will probably be included in the next i2c version.
|
||||
|
||||
* algo-bit.c, i2c-core.c: Debugging level turned down
|
||||
The transfer functions are now on debug level 2, to keep the noise within
|
||||
acceptable limits.
|
||||
|
||||
* New file: Module.mk
|
||||
The Makefile fragment we use to compile the files in this directory.
|
||||
|
||||
@@ -32,16 +26,3 @@ Here come the changes:
|
||||
* Removed files: object files and executables
|
||||
Everywhere, remakeable files are removed, to keep the source distribution
|
||||
small and lean.
|
||||
|
||||
! i2c-core.c: i2c_del_adapter() change
|
||||
Replaced
|
||||
i2c_detach_client(client);
|
||||
with:
|
||||
client->driver->detach_client(client);
|
||||
|
||||
! i2c-core.c, i2c-core.h: function i2c_adapter_id added
|
||||
We needed a function that would return a low, unique identifier for each
|
||||
adapter. Putting it anywhere else would have created new, unneeded
|
||||
module dependencies.
|
||||
|
||||
! bit-mb.c: removed spurious semicolon
|
||||
+1
-1
@@ -11,7 +11,7 @@ MOD_SUB_DIRS = drivers
|
||||
#MX_OBJS = i2c-core.o algo-bit.o i2c-dev.o bit-lp.o bit-velle.o algo-pcf.o
|
||||
MX_OBJS = i2c-core.o algo-bit.o i2c-dev.o
|
||||
|
||||
M_OBJS = bit-lp.o bit-velle.o bit-mb.o
|
||||
M_OBJS = bit-lp.o bit-velle.o bit-via.o
|
||||
EXTRA_CFLAGS = -Wno-unused
|
||||
|
||||
here:
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ MODULE_DIR := i2c
|
||||
# defined value verbatim into the command-list of rules...
|
||||
I2CTARGETS := $(MODULE_DIR)/i2c-core.o $(MODULE_DIR)/algo-bit.o \
|
||||
$(MODULE_DIR)/bit-lp.o \
|
||||
$(MODULE_DIR)/bit-velle.o $(MODULE_DIR)/bit-mb.o
|
||||
$(MODULE_DIR)/bit-velle.o $(MODULE_DIR)/bit-via.o
|
||||
I2CADDTARGETS := $(MODULE_DIR)/i2c-dev.o
|
||||
|
||||
I2CHEADERFILES := $(MODULE_DIR)/i2c.h
|
||||
|
||||
@@ -13,6 +13,11 @@ Currently, the following modules are running in the new mode:
|
||||
The other modules, esp. algo-pcf.c still need to be converted. For the
|
||||
hw specific mods, this should be relatively easy & quick.
|
||||
|
||||
*
|
||||
* NOTE: The algo-pcf part is currently in the works, thanks to Hans Berglund
|
||||
* (hb@mailhost.spacetec.no).
|
||||
*
|
||||
|
||||
A simple driver example is in drivers -- a piece of code to access EEPROMs.
|
||||
|
||||
Simon (simon@tk.uni-linz.ac.at)
|
||||
|
||||
File renamed without changes.
+2
-4
@@ -17,7 +17,7 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
static char alg_rcsid[] = "$Id: algo-bit.c,v 1.7 1998/09/28 06:45:38 i2c Exp i2c $";
|
||||
static char alg_rcsid[] = "$Id: algo-bit.c,v 1.8 1998/12/30 08:36:08 i2c Exp i2c $";
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
@@ -70,7 +70,7 @@ static char alg_rcsid[] = "$Id: algo-bit.c,v 1.7 1998/09/28 06:45:38 i2c Exp i2c
|
||||
|
||||
/* module parameters:
|
||||
*/
|
||||
int i2c_debug=0;
|
||||
int i2c_debug=1;
|
||||
int bit_test=0; /* see if the line-setting functions work */
|
||||
int bit_scan=0; /* have a look at what's hanging 'round */
|
||||
|
||||
@@ -639,10 +639,8 @@ MODULE_PARM_DESC(bit_scan, "Scan for active chips on the bus");
|
||||
MODULE_PARM_DESC(i2c_debug,"debug level - 0 off; 1 normal; 2,3 more verbose; 9 bit-protocol");
|
||||
|
||||
|
||||
#ifndef LM_SENSORS
|
||||
EXPORT_SYMBOL(i2c_bit_add_bus);
|
||||
EXPORT_SYMBOL(i2c_bit_del_bus);
|
||||
#endif
|
||||
|
||||
|
||||
int init_module(void)
|
||||
|
||||
+1
-3
@@ -17,7 +17,7 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
static char rcsid[] = "$Id: bit-lp.c,v 1.5 1998/09/28 06:45:38 i2c Exp i2c $";
|
||||
static char rcsid[] = "$Id: bit-lp.c,v 1.6 1998/12/30 08:36:08 i2c Exp i2c $";
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
#include <linux/kernel.h>
|
||||
@@ -151,9 +151,7 @@ MODULE_DESCRIPTION("I2C-Bus adapter routines for Philips parallel port adapter")
|
||||
|
||||
MODULE_PARM(base, "i");
|
||||
|
||||
#ifndef LM_SENSORS
|
||||
EXPORT_NO_SYMBOLS;
|
||||
#endif
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
|
||||
+4
-1
@@ -17,9 +17,12 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
static char rcsid[] = "$Id: bit-velle.c,v 1.3 1998/09/15 18:50:04 i2c Exp $";
|
||||
static char rcsid[] = "$Id: bit-velle.c,v 1.4 1998/12/30 08:36:08 i2c Exp i2c $";
|
||||
/*
|
||||
* $Log: bit-velle.c,v $
|
||||
* Revision 1.4 1998/12/30 08:36:08 i2c
|
||||
* *** empty log message ***
|
||||
*
|
||||
* Revision 1.3 1998/09/15 18:50:04 i2c
|
||||
* *** empty log message ***
|
||||
*
|
||||
|
||||
File renamed without changes.
@@ -1,182 +0,0 @@
|
||||
/*
|
||||
EISCA Fan SMBus (or i2c) driver
|
||||
Based on various char-device sources.
|
||||
|
||||
Copyright (c) 1998 Kyösti Mälkki
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/timer.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/malloc.h>
|
||||
#include <linux/stat.h>
|
||||
#include <linux/proc_fs.h>
|
||||
|
||||
#include "i2c.h"
|
||||
#include "algo-bit.h"
|
||||
|
||||
/* Fan defines */
|
||||
#define I2C_GL518SM 0x2d /* 7-bit i2c slave address */
|
||||
#define REGMASK 0x1f
|
||||
#define PROCNAME "temperature"
|
||||
|
||||
/* i2c */
|
||||
static struct i2c_driver driver;
|
||||
static struct i2c_client client_template;
|
||||
static struct i2c_client *client = &client_template;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
static unsigned int gl_sysmon_read(int reg, int count)
|
||||
{
|
||||
struct i2c_msg msgs[2];
|
||||
char write[1]={0};
|
||||
char read[2]={0,0};
|
||||
int ret;
|
||||
unsigned int val;
|
||||
|
||||
msgs[0].addr = msgs[1].addr = client->addr;
|
||||
msgs[0].flags = msgs[1].flags =
|
||||
(client->flags & (I2C_M_TEN|I2C_M_TENMASK));
|
||||
|
||||
msgs[0].len = 1;
|
||||
msgs[0].buf = write;
|
||||
write[0] = reg & REGMASK;
|
||||
|
||||
msgs[1].flags |= I2C_M_RD;
|
||||
msgs[1].len = count;
|
||||
msgs[1].buf = read;
|
||||
|
||||
ret = i2c_transfer(client->adapter, msgs, 2);
|
||||
|
||||
if ( 2 != ret ) return ret;
|
||||
if (count==1)
|
||||
val = read[0] & 0xff;
|
||||
else
|
||||
val = ( (read[0]<<8)|(read[1] & 0xff) ) & 0xffff;
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
static int gl_sysmon_write(int reg, unsigned int val, int count)
|
||||
{
|
||||
unsigned char buffer[5];
|
||||
|
||||
buffer[0] = reg & REGMASK;
|
||||
if (count==2) {
|
||||
buffer[1] = (val >> 8) & 0xff;
|
||||
buffer[2] = val & 0xff;
|
||||
count = 3;
|
||||
} else {
|
||||
buffer[1] = val & 0xff;
|
||||
count = 2;
|
||||
}
|
||||
|
||||
if (count != i2c_master_send(client, buffer, count))
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int gl_sysmon_info(char *buf, char **start, off_t fpos, int length, int dummy)
|
||||
{
|
||||
char * p=buf;
|
||||
int i;
|
||||
unsigned int regs[32];
|
||||
|
||||
for (i=0; i<32; i++) {
|
||||
regs[i] = 0;
|
||||
regs[i] = gl_sysmon_read(i, (i>6 && i<13) ? 2 : 1);
|
||||
}
|
||||
|
||||
p += sprintf(buf, "CPU temperature %d Celsius\n", (regs[4]-119));
|
||||
|
||||
return p - buf;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
static struct proc_dir_entry *ent;
|
||||
|
||||
static int gl_sysmon_attach(struct i2c_adapter *adap)
|
||||
{
|
||||
client->adapter = adap;
|
||||
|
||||
i2c_attach_client(client);
|
||||
gl_sysmon_write(3, 64, 1);
|
||||
|
||||
ent = create_proc_entry(PROCNAME, 0, 0);
|
||||
ent->get_info = gl_sysmon_info;
|
||||
|
||||
printk("EISCA Fan connected\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int gl_sysmon_detach(struct i2c_client *client)
|
||||
{
|
||||
gl_sysmon_write(3, 128, 1);
|
||||
i2c_detach_client(client);
|
||||
remove_proc_entry(PROCNAME, 0);
|
||||
|
||||
printk("EISCA Fan disconnected\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
gl_sysmon_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
static struct i2c_driver driver = {
|
||||
"GL518SM",
|
||||
-1,
|
||||
DF_NOTIFY,
|
||||
gl_sysmon_attach,
|
||||
gl_sysmon_detach,
|
||||
gl_sysmon_command,
|
||||
};
|
||||
|
||||
static struct i2c_client client_template = {
|
||||
"EISCA Cooler",
|
||||
I2C_DRIVERID_GL518SM,
|
||||
0,
|
||||
I2C_GL518SM,
|
||||
NULL,
|
||||
&driver
|
||||
};
|
||||
|
||||
#ifdef MODULE
|
||||
MODULE_AUTHOR("Kyosti Malkki <kmalkki@cc.hut.fi>");
|
||||
MODULE_DESCRIPTION("i2c driver for GL518SM");
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
i2c_add_driver(&driver);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void cleanup_module(void)
|
||||
{
|
||||
i2c_del_driver(&driver);
|
||||
}
|
||||
#endif
|
||||
+11
-13
@@ -17,7 +17,7 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
#define RCSID "$Id: i2c.c,v 1.7 1998/09/28 06:45:38 i2c Exp i2c $"
|
||||
#define RCSID "$Id: i2c-core.c,v 1.1 1998/12/30 08:36:08 i2c Exp i2c $"
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
#include <linux/module.h>
|
||||
@@ -30,8 +30,8 @@
|
||||
/* ----- global defines ---------------------------------------------------- */
|
||||
|
||||
/* exclusive access to the bus */
|
||||
/*#define SPINLOCK*/
|
||||
#ifdef SPINLOCK
|
||||
/*#define I2C_SPINLOCK*/
|
||||
#ifdef I2C_SPINLOCK
|
||||
#define I2C_LOCK(adap) spin_lock_irqsave(&adap->lock,adap->lockflags)
|
||||
#define I2C_UNLOCK(adap) spin_unlock_irqrestore(&adap->lock,adap->lockflags)
|
||||
#else
|
||||
@@ -135,7 +135,7 @@ int i2c_add_adapter(struct i2c_adapter *adap)
|
||||
adap_count++;
|
||||
|
||||
/* init data types */
|
||||
#ifdef SPINLOCK
|
||||
#ifdef I2C_SPINLOCK
|
||||
adap->lock = (spinlock_t)SPIN_LOCK_UNLOCKED;
|
||||
#else
|
||||
adap->lock = MUTEX;
|
||||
@@ -173,8 +173,8 @@ int i2c_del_adapter(struct i2c_adapter *adap)
|
||||
* flag, as _all_ clients that reside on the adapter
|
||||
* must be deleted, as this would cause invalid states.
|
||||
*/
|
||||
/* i2c_detach_client(client); */
|
||||
client->driver->detach_client(client);
|
||||
/* i2c_detach_client(client); --- frodo */
|
||||
}
|
||||
/* all done, now unregister */
|
||||
adapters[i] = NULL;
|
||||
@@ -336,7 +336,7 @@ int i2c_transfer(struct i2c_adapter * adap, struct i2c_msg msgs[],int num)
|
||||
{
|
||||
int ret;
|
||||
|
||||
DEB2(printk("master_xfer: %s with %d msgs.\n",adap->name,num));
|
||||
DEB(printk("master_xfer: %s with %d msgs.\n",adap->name,num));
|
||||
|
||||
I2C_LOCK(adap);
|
||||
ret = adap->algo->master_xfer(adap,msgs,num);
|
||||
@@ -355,7 +355,7 @@ int i2c_master_send(struct i2c_client *client,const char *buf ,int count)
|
||||
msg.len = count;
|
||||
(const char *)msg.buf = buf;
|
||||
|
||||
DEB2(printk("master_send: writing %d bytes on %s.\n",
|
||||
DEB(printk("master_send: writing %d bytes on %s.\n",
|
||||
count,client->adapter->name));
|
||||
|
||||
I2C_LOCK(adap);
|
||||
@@ -379,7 +379,7 @@ int i2c_master_recv(struct i2c_client *client, char *buf ,int count)
|
||||
msg.len = count;
|
||||
msg.buf = buf;
|
||||
|
||||
DEB2(printk("master_recv: reading %d bytes on %s.\n",
|
||||
DEB(printk("master_recv: reading %d bytes on %s.\n",
|
||||
count,client->adapter->name));
|
||||
|
||||
I2C_LOCK(adap);
|
||||
@@ -435,7 +435,9 @@ int i2c_probe(struct i2c_client *client, int low_addr, int hi_addr)
|
||||
I2C_UNLOCK(client->adapter);
|
||||
return (i <= hi_addr) ? i : -1;
|
||||
}
|
||||
|
||||
/* +++ frodo
|
||||
* return id number for a specific adapter
|
||||
*/
|
||||
int i2c_adapter_id(struct i2c_adapter *adap)
|
||||
{
|
||||
int i;
|
||||
@@ -445,15 +447,12 @@ int i2c_adapter_id(struct i2c_adapter *adap)
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef MODULE
|
||||
MODULE_AUTHOR("Simon G. Vogl <simon@tk.uni-linz.ac.at>");
|
||||
MODULE_DESCRIPTION("I2C-Bus main module");
|
||||
MODULE_PARM(i2c_debug, "i");
|
||||
MODULE_PARM_DESC(i2c_debug,"debug level");
|
||||
|
||||
#ifndef LM_SENSORS
|
||||
EXPORT_SYMBOL(i2c_add_algorithm);
|
||||
EXPORT_SYMBOL(i2c_del_algorithm);
|
||||
EXPORT_SYMBOL(i2c_add_adapter);
|
||||
@@ -467,7 +466,6 @@ EXPORT_SYMBOL(i2c_master_send);
|
||||
EXPORT_SYMBOL(i2c_master_recv);
|
||||
EXPORT_SYMBOL(i2c_control);
|
||||
EXPORT_SYMBOL(i2c_transfer);
|
||||
#endif
|
||||
|
||||
|
||||
int init_module(void)
|
||||
|
||||
+2
-4
@@ -17,7 +17,7 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
#define RCSID "$Id: i2c-dev.c,v 1.6 1998/09/28 06:45:38 i2c Exp i2c $"
|
||||
#define RCSID "$Id: i2c-dev.c,v 1.7 1998/12/30 08:36:08 i2c Exp i2c $"
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
#include <linux/kernel.h>
|
||||
@@ -183,7 +183,7 @@ int i2c_read (struct inode *inode, struct file *file, char *buf, int count)
|
||||
#else
|
||||
memcpy_tofs(buf,tmp,count);
|
||||
#endif
|
||||
|
||||
kfree(tmp);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -337,9 +337,7 @@ struct i2c_driver driver = {
|
||||
MODULE_AUTHOR("Simon G. Vogl <simon@tk.uni-linz.ac.at>");
|
||||
MODULE_DESCRIPTION("I2C-Bus character device interface");
|
||||
|
||||
#ifndef LM_SENSORS
|
||||
EXPORT_NO_SYMBOLS;
|
||||
#endif
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
|
||||
@@ -25,9 +25,9 @@
|
||||
#ifdef __KERNEL__
|
||||
|
||||
/* define spinlock to use spinlocks for sync., else use semaphores*/
|
||||
/*#define SPINLOCK*/
|
||||
/*#define I2C_SPINLOCK*/
|
||||
|
||||
#ifdef SPINLOCK
|
||||
#ifdef I2C_SPINLOCK
|
||||
#include <asm/spinlock.h> /* for spinlock_t */
|
||||
#else
|
||||
#include <asm/semaphore.h>
|
||||
@@ -194,7 +194,7 @@ struct i2c_adapter {
|
||||
/* and can be set via the i2c_ioctl call */
|
||||
|
||||
/* data fields that are valid for all devices */
|
||||
#ifdef SPINLOCK
|
||||
#ifdef I2C_SPINLOCK
|
||||
spinlock_t lock;/* used to access the adapter exclusively */
|
||||
unsigned long lockflags;
|
||||
#else
|
||||
@@ -215,17 +215,6 @@ struct i2c_adapter {
|
||||
#define DF_NOTIFY 0x01 /* notify on bus (de/a)ttaches */
|
||||
|
||||
|
||||
#if 0 /* deprecate! */
|
||||
/*flags for the client struct:
|
||||
*/
|
||||
#define CF_TEN 0x100000 /* we have a ten bit chip address */
|
||||
#define CF_TEN0 0x100000 /* herein lie the first 2 bits */
|
||||
#define CF_TEN1 0x110000
|
||||
#define CF_TEN2 0x120000
|
||||
#define CF_TEN3 0x130000
|
||||
#define TENMASK 0x130000
|
||||
#endif
|
||||
|
||||
/* ----- functions exported by i2c.o */
|
||||
|
||||
/* administration...
|
||||
@@ -253,9 +242,9 @@ extern int i2c_probe(struct i2c_client *client, int low_addr, int hi_addr);
|
||||
*/
|
||||
extern int i2c_control(struct i2c_client *,unsigned int, unsigned long);
|
||||
|
||||
|
||||
/* This call returns a unique low identifier for each registered adapter,
|
||||
or -1 if the adapter was not regisitered. */
|
||||
* or -1 if the adapter was not regisitered.
|
||||
*/
|
||||
extern int i2c_adapter_id(struct i2c_adapter *adap);
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
@@ -304,7 +293,16 @@ extern int i2c_adapter_id(struct i2c_adapter *adap);
|
||||
#define I2C_DRIVERID_MSP3400 1
|
||||
#define I2C_DRIVERID_TUNER 2
|
||||
#define I2C_DRIVERID_VIDEOTEXT 3
|
||||
#define I2C_DRIVERID_GL518SM 4
|
||||
#define I2C_DRIVERID_GL518SM 4 /* hardware monitor cpu temp. */
|
||||
#define I2C_DRIVERID_TEA6420 5 /* audio matrix switch */
|
||||
#define I2C_DRIVERID_TEA6415 6 /* video matrix switch */
|
||||
#define I2C_DRIVERID_TDA9840 7 /* stereo sound processor */
|
||||
#define I2C_DRIVERID_SAA7111 8 /* video input processor */
|
||||
|
||||
#define I2C_DRIVERID_EXP0 0xF0 /* experimental use id's */
|
||||
#define I2C_DRIVERID_EXP1 0xF1
|
||||
#define I2C_DRIVERID_EXP2 0xF2
|
||||
#define I2C_DRIVERID_EXP3 0xF3
|
||||
|
||||
/*
|
||||
* ---- Adapter types ----------------------------------------------------
|
||||
@@ -313,11 +311,13 @@ extern int i2c_adapter_id(struct i2c_adapter *adap);
|
||||
* interface types, as a PCF 8584 needs other care than a bit adapter.
|
||||
*/
|
||||
|
||||
#define ALGO_NONE 0x00000
|
||||
#define ALGO_BIT 0x10000 /* bit style adapters */
|
||||
#define ALGO_PCF 0x20000 /* PCF 8584 style adapters */
|
||||
#define ALGO_NONE 0x000000
|
||||
#define ALGO_BIT 0x010000 /* bit style adapters */
|
||||
#define ALGO_PCF 0x020000 /* PCF 8584 style adapters */
|
||||
|
||||
#define ALGO_MASK 0xf0000 /* Mask for algorithms */
|
||||
#define ALGO_EXP 0x800000 /* experimental */
|
||||
|
||||
#define ALGO_MASK 0xff0000 /* Mask for algorithms */
|
||||
#define ALGO_SHIFT 0x10 /* right shift to get index values */
|
||||
|
||||
#define I2C_HW_ADAPS 0x10000 /* number of different hw implements per*/
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include <linux/kernel.h>
|
||||
|
||||
#include "i2c.h"
|
||||
#ifdef SPINLOCK
|
||||
#ifdef I2C_SPINLOCK
|
||||
#include <asm/spinlock.h>
|
||||
#else
|
||||
#include <asm/semaphore.h>
|
||||
|
||||
@@ -35,8 +35,8 @@
|
||||
*/
|
||||
#include <asm/types.h>
|
||||
|
||||
/* SPINLOCK is defined in i2c.h. */
|
||||
#ifdef SPINLOCK
|
||||
/* I2C_SPINLOCK is defined in i2c.h. */
|
||||
#ifdef I2C_SPINLOCK
|
||||
#include <asm/spinlock.h>
|
||||
#else
|
||||
#include <asm/semaphore.h>
|
||||
@@ -104,14 +104,14 @@ struct isa_algorithm {
|
||||
|
||||
/* An adapter is a specifc instance of a bus: for each detected bus, there will
|
||||
be an adapter. Its operation is controlled by an algorithm.
|
||||
SPINLOCK must be the same as declared in i2c.h.
|
||||
I2C_SPINLOCK must be the same as declared in i2c.h.
|
||||
This structure is essentially the same as i2c_algorithm. */
|
||||
struct isa_adapter {
|
||||
char name[32];
|
||||
unsigned int id;
|
||||
struct isa_algorithm *algo;
|
||||
void *data;
|
||||
#ifdef SPINLOCK
|
||||
#ifdef I2C_SPINLOCK
|
||||
spinlock_t lock;
|
||||
unsigned long lockflags;
|
||||
#else
|
||||
|
||||
@@ -54,8 +54,8 @@ union smbus_data {
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
/* SPINLOCK is defined in i2c.h. */
|
||||
#ifdef SPINLOCK
|
||||
/* I2C_SPINLOCK is defined in i2c.h. */
|
||||
#ifdef I2C_SPINLOCK
|
||||
#include <asm/spinlock.h>
|
||||
#else
|
||||
#include <asm/semaphore.h>
|
||||
@@ -118,14 +118,14 @@ struct smbus_algorithm {
|
||||
|
||||
/* An adapter is a specifc instance of a bus: for each detected bus, there will
|
||||
be an adapter. Its operation is controlled by an algorithm.
|
||||
SPINLOCK must be the same as declared in i2c.h.
|
||||
I2C_SPINLOCK must be the same as declared in i2c.h.
|
||||
This structure is an extension of i2c_algorithm. */
|
||||
struct smbus_adapter {
|
||||
char name[32];
|
||||
unsigned int id;
|
||||
struct smbus_algorithm *algo;
|
||||
void *data;
|
||||
#ifdef SPINLOCK
|
||||
#ifdef I2C_SPINLOCK
|
||||
spinlock_t lock;
|
||||
unsigned long lockflags;
|
||||
#else
|
||||
|
||||
+3
-3
@@ -23,7 +23,7 @@
|
||||
#include <linux/stddef.h>
|
||||
|
||||
#include "i2c.h"
|
||||
#ifdef SPINLOCK
|
||||
#ifdef I2C_SPINLOCK
|
||||
#include <asm/spinlock.h>
|
||||
#else
|
||||
#include <asm/semaphore.h>
|
||||
@@ -76,14 +76,14 @@ s32 smbus_access (struct i2c_adapter * adapter, u8 addr, char read_write,
|
||||
{
|
||||
int res;
|
||||
if ((adapter->id & ALGO_MASK) == ALGO_SMBUS) {
|
||||
#ifdef SPINLOCK
|
||||
#ifdef I2C_SPINLOCK
|
||||
spin_lock_irqsave(&adapter->lock,adapter->lockflags);
|
||||
#else
|
||||
down(&adapter->lock);
|
||||
#endif
|
||||
res = ((struct smbus_adapter *) adapter) ->
|
||||
smbus_access(addr,read_write,command,size,data);
|
||||
#ifdef SPINLOCK
|
||||
#ifdef I2C_SPINLOCK
|
||||
spin_unlock_irqrestore(&adapter->lock,adapter->lockflags);
|
||||
#else
|
||||
up(&adapter->lock);
|
||||
|
||||
@@ -88,5 +88,4 @@ clean-lib:
|
||||
$(RM) $(LIBTARGETS) $(LIBSHOBJECTS) $(LIBSTOBJECTS)
|
||||
$(RM) $(LIBSHOBJECTS:.lo=.ld) $(LIBSTOBJECTS:.ao=.ad)
|
||||
$(RM) $(LIBOTHEROBJECTS:.o=.c) $(LIBEXTRACLEAN)
|
||||
$(RM)
|
||||
clean :: clean-lib
|
||||
Reference in new issue
Block a user