Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
e605dc6c
Commit
e605dc6c
authored
Apr 09, 2003
by
Greg Kroah-Hartman
Browse files
Options
Browse Files
Download
Plain Diff
Merge kroah.com:/home/greg/linux/BK/bleed-2.5
into kroah.com:/home/greg/linux/BK/i2c-2.5
parents
75b08514
7481987d
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
370 additions
and
310 deletions
+370
-310
drivers/i2c/chips/Kconfig
drivers/i2c/chips/Kconfig
+3
-2
drivers/i2c/chips/via686a.c
drivers/i2c/chips/via686a.c
+295
-244
drivers/i2c/chips/w83781d.c
drivers/i2c/chips/w83781d.c
+3
-3
drivers/i2c/i2c-adap-ite.c
drivers/i2c/i2c-adap-ite.c
+3
-1
drivers/i2c/i2c-dev.c
drivers/i2c/i2c-dev.c
+46
-51
drivers/i2c/i2c-frodo.c
drivers/i2c/i2c-frodo.c
+3
-1
drivers/i2c/scx200_i2c.c
drivers/i2c/scx200_i2c.c
+4
-2
include/linux/i2c-dev.h
include/linux/i2c-dev.h
+3
-3
include/linux/i2c.h
include/linux/i2c.h
+10
-3
No files found.
drivers/i2c/chips/Kconfig
View file @
e605dc6c
...
@@ -66,7 +66,8 @@ config SENSORS_W83781D
...
@@ -66,7 +66,8 @@ config SENSORS_W83781D
config I2C_SENSOR
config I2C_SENSOR
tristate
tristate
depends on SENSORS_ADM1021 || SENSORS_LM75 || SENSORS_VIA686A || SENSORS_W83781D
default y if SENSORS_ADM1021=y || SENSORS_LM75=y || SENSORS_VIA686A=y || SENSORS_W83781D=y
default m
default m if SENSORS_ADM1021=m || SENSORS_LM75=m || SENSORS_VIA686A=m || SENSORS_W83781D=m
default n
endmenu
endmenu
drivers/i2c/chips/via686a.c
View file @
e605dc6c
This diff is collapsed.
Click to expand it.
drivers/i2c/chips/w83781d.c
View file @
e605dc6c
...
@@ -364,7 +364,7 @@ static ssize_t show_##reg (struct device *dev, char *buf, int nr) \
...
@@ -364,7 +364,7 @@ static ssize_t show_##reg (struct device *dev, char *buf, int nr) \
\
\
w83781d_update_client(client); \
w83781d_update_client(client); \
\
\
return sprintf(buf,"%ld\n", (long)IN_FROM_REG(data->reg[nr])); \
return sprintf(buf,"%ld\n", (long)IN_FROM_REG(data->reg[nr]
* 10
)); \
}
}
show_in_reg
(
in
);
show_in_reg
(
in
);
show_in_reg
(
in_min
);
show_in_reg
(
in_min
);
...
@@ -378,7 +378,7 @@ static ssize_t store_in_##reg (struct device *dev, const char *buf, size_t count
...
@@ -378,7 +378,7 @@ static ssize_t store_in_##reg (struct device *dev, const char *buf, size_t count
u32 val; \
u32 val; \
\
\
val = simple_strtoul(buf, NULL, 10); \
val = simple_strtoul(buf, NULL, 10); \
data->in_##reg[nr] =
IN_TO_REG(val
); \
data->in_##reg[nr] =
(IN_TO_REG(val) / 10
); \
w83781d_write_value(client, W83781D_REG_IN_##REG(nr), data->in_##reg[nr]); \
w83781d_write_value(client, W83781D_REG_IN_##REG(nr), data->in_##reg[nr]); \
\
\
return count; \
return count; \
...
@@ -712,7 +712,7 @@ store_fan_div_reg(struct device *dev, const char *buf, size_t count, int nr)
...
@@ -712,7 +712,7 @@ store_fan_div_reg(struct device *dev, const char *buf, size_t count, int nr)
{
{
struct
i2c_client
*
client
=
to_i2c_client
(
dev
);
struct
i2c_client
*
client
=
to_i2c_client
(
dev
);
struct
w83781d_data
*
data
=
i2c_get_clientdata
(
client
);
struct
w83781d_data
*
data
=
i2c_get_clientdata
(
client
);
u32
val
,
old
,
old2
,
old3
;
u32
val
,
old
,
old2
,
old3
=
0
;
val
=
simple_strtoul
(
buf
,
NULL
,
10
);
val
=
simple_strtoul
(
buf
,
NULL
,
10
);
old
=
w83781d_read_value
(
client
,
W83781D_REG_VID_FANDIV
);
old
=
w83781d_read_value
(
client
,
W83781D_REG_VID_FANDIV
);
...
...
drivers/i2c/i2c-adap-ite.c
View file @
e605dc6c
...
@@ -196,9 +196,11 @@ static struct i2c_algo_iic_data iic_ite_data = {
...
@@ -196,9 +196,11 @@ static struct i2c_algo_iic_data iic_ite_data = {
static
struct
i2c_adapter
iic_ite_ops
=
{
static
struct
i2c_adapter
iic_ite_ops
=
{
.
owner
=
THIS_MODULE
,
.
owner
=
THIS_MODULE
,
.
name
=
"ITE IIC adapter"
,
.
id
=
I2C_HW_I_IIC
,
.
id
=
I2C_HW_I_IIC
,
.
algo_data
=
&
iic_ite_data
,
.
algo_data
=
&
iic_ite_data
,
.
dev
=
{
.
name
=
"ITE IIC adapter"
,
},
};
};
/* Called when the module is loaded. This function starts the
/* Called when the module is loaded. This function starts the
...
...
drivers/i2c/i2c-dev.c
View file @
e605dc6c
...
@@ -77,7 +77,7 @@ static struct i2c_adapter *i2cdev_adaps[I2CDEV_ADAPS_MAX];
...
@@ -77,7 +77,7 @@ static struct i2c_adapter *i2cdev_adaps[I2CDEV_ADAPS_MAX];
static
struct
i2c_driver
i2cdev_driver
=
{
static
struct
i2c_driver
i2cdev_driver
=
{
.
owner
=
THIS_MODULE
,
.
owner
=
THIS_MODULE
,
.
name
=
"
i2c-dev dummy
driver"
,
.
name
=
"
dev
driver"
,
.
id
=
I2C_DRIVERID_I2CDEV
,
.
id
=
I2C_DRIVERID_I2CDEV
,
.
flags
=
I2C_DF_DUMMY
,
.
flags
=
I2C_DF_DUMMY
,
.
attach_adapter
=
i2cdev_attach_adapter
,
.
attach_adapter
=
i2cdev_attach_adapter
,
...
@@ -100,10 +100,6 @@ static ssize_t i2cdev_read (struct file *file, char *buf, size_t count,
...
@@ -100,10 +100,6 @@ static ssize_t i2cdev_read (struct file *file, char *buf, size_t count,
char
*
tmp
;
char
*
tmp
;
int
ret
;
int
ret
;
#ifdef DEBUG
struct
inode
*
inode
=
file
->
f_dentry
->
d_inode
;
#endif
/* DEBUG */
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
)
...
@@ -114,10 +110,8 @@ static ssize_t i2cdev_read (struct file *file, char *buf, size_t count,
...
@@ -114,10 +110,8 @@ static ssize_t i2cdev_read (struct file *file, char *buf, size_t count,
if
(
tmp
==
NULL
)
if
(
tmp
==
NULL
)
return
-
ENOMEM
;
return
-
ENOMEM
;
#ifdef DEBUG
pr_debug
(
"i2c-dev.o: i2c-%d reading %d bytes.
\n
"
,
printk
(
KERN_DEBUG
"i2c-dev.o: i2c-%d reading %d bytes.
\n
"
,
minor
(
inode
->
i_rdev
),
minor
(
file
->
f_dentry
->
d_inode
->
i_rdev
),
count
);
count
);
#endif
ret
=
i2c_master_recv
(
client
,
tmp
,
count
);
ret
=
i2c_master_recv
(
client
,
tmp
,
count
);
if
(
ret
>=
0
)
if
(
ret
>=
0
)
...
@@ -133,10 +127,6 @@ static ssize_t i2cdev_write (struct file *file, const char *buf, size_t count,
...
@@ -133,10 +127,6 @@ static ssize_t i2cdev_write (struct file *file, const char *buf, size_t count,
char
*
tmp
;
char
*
tmp
;
struct
i2c_client
*
client
=
(
struct
i2c_client
*
)
file
->
private_data
;
struct
i2c_client
*
client
=
(
struct
i2c_client
*
)
file
->
private_data
;
#ifdef DEBUG
struct
inode
*
inode
=
file
->
f_dentry
->
d_inode
;
#endif
/* DEBUG */
if
(
count
>
8192
)
if
(
count
>
8192
)
count
=
8192
;
count
=
8192
;
...
@@ -149,10 +139,9 @@ static ssize_t i2cdev_write (struct file *file, const char *buf, size_t count,
...
@@ -149,10 +139,9 @@ static ssize_t i2cdev_write (struct file *file, const char *buf, size_t count,
return
-
EFAULT
;
return
-
EFAULT
;
}
}
#ifdef DEBUG
pr_debug
(
"i2c-dev.o: i2c-%d writing %d bytes.
\n
"
,
printk
(
KERN_DEBUG
"i2c-dev.o: i2c-%d writing %d bytes.
\n
"
,
minor
(
inode
->
i_rdev
),
minor
(
file
->
f_dentry
->
d_inode
->
i_rdev
),
count
);
count
);
#endif
ret
=
i2c_master_send
(
client
,
tmp
,
count
);
ret
=
i2c_master_send
(
client
,
tmp
,
count
);
kfree
(
tmp
);
kfree
(
tmp
);
return
ret
;
return
ret
;
...
@@ -169,10 +158,8 @@ int i2cdev_ioctl (struct inode *inode, struct file *file, unsigned int cmd,
...
@@ -169,10 +158,8 @@ int i2cdev_ioctl (struct inode *inode, struct file *file, unsigned int cmd,
int
i
,
datasize
,
res
;
int
i
,
datasize
,
res
;
unsigned
long
funcs
;
unsigned
long
funcs
;
#ifdef DEBUG
pr_debug
(
"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 */
switch
(
cmd
)
{
switch
(
cmd
)
{
case
I2C_SLAVE
:
case
I2C_SLAVE
:
...
@@ -207,6 +194,11 @@ int i2cdev_ioctl (struct inode *inode, struct file *file, unsigned int cmd,
...
@@ -207,6 +194,11 @@ int i2cdev_ioctl (struct inode *inode, struct file *file, unsigned int cmd,
sizeof
(
rdwr_arg
)))
sizeof
(
rdwr_arg
)))
return
-
EFAULT
;
return
-
EFAULT
;
/* Put an arbritrary limit on the number of messages that can
* be sent at once */
if
(
rdwr_arg
.
nmsgs
>
42
)
return
-
EINVAL
;
rdwr_pa
=
(
struct
i2c_msg
*
)
rdwr_pa
=
(
struct
i2c_msg
*
)
kmalloc
(
rdwr_arg
.
nmsgs
*
sizeof
(
struct
i2c_msg
),
kmalloc
(
rdwr_arg
.
nmsgs
*
sizeof
(
struct
i2c_msg
),
GFP_KERNEL
);
GFP_KERNEL
);
...
@@ -214,38 +206,43 @@ int i2cdev_ioctl (struct inode *inode, struct file *file, unsigned int cmd,
...
@@ -214,38 +206,43 @@ int i2cdev_ioctl (struct inode *inode, struct file *file, unsigned int cmd,
if
(
rdwr_pa
==
NULL
)
return
-
ENOMEM
;
if
(
rdwr_pa
==
NULL
)
return
-
ENOMEM
;
res
=
0
;
res
=
0
;
for
(
i
=
0
;
i
<
rdwr_arg
.
nmsgs
;
i
++
)
for
(
i
=
0
;
i
<
rdwr_arg
.
nmsgs
;
i
++
)
{
{
if
(
copy_from_user
(
&
(
rdwr_pa
[
i
]),
if
(
copy_from_user
(
&
(
rdwr_pa
[
i
]),
&
(
rdwr_arg
.
msgs
[
i
]),
&
(
rdwr_arg
.
msgs
[
i
]),
sizeof
(
rdwr_pa
[
i
])))
sizeof
(
rdwr_pa
[
i
])))
{
{
res
=
-
EFAULT
;
res
=
-
EFAULT
;
break
;
break
;
}
}
/* Limit the size of the message to a sane amount */
if
(
rdwr_pa
[
i
].
len
>
8192
)
{
res
=
-
EINVAL
;
break
;
}
rdwr_pa
[
i
].
buf
=
kmalloc
(
rdwr_pa
[
i
].
len
,
GFP_KERNEL
);
rdwr_pa
[
i
].
buf
=
kmalloc
(
rdwr_pa
[
i
].
len
,
GFP_KERNEL
);
if
(
rdwr_pa
[
i
].
buf
==
NULL
)
if
(
rdwr_pa
[
i
].
buf
==
NULL
)
{
{
res
=
-
ENOMEM
;
res
=
-
ENOMEM
;
break
;
break
;
}
}
if
(
copy_from_user
(
rdwr_pa
[
i
].
buf
,
if
(
copy_from_user
(
rdwr_pa
[
i
].
buf
,
rdwr_arg
.
msgs
[
i
].
buf
,
rdwr_arg
.
msgs
[
i
].
buf
,
rdwr_pa
[
i
].
len
))
rdwr_pa
[
i
].
len
))
{
{
kfree
(
rdwr_pa
[
i
].
buf
);
res
=
-
EFAULT
;
res
=
-
EFAULT
;
break
;
break
;
}
}
}
}
if
(
!
res
)
if
(
res
<
0
)
{
{
int
j
;
for
(
j
=
0
;
j
<
i
;
++
j
)
kfree
(
rdwr_pa
[
j
].
buf
);
kfree
(
rdwr_pa
);
return
res
;
}
if
(
!
res
)
{
res
=
i2c_transfer
(
client
->
adapter
,
res
=
i2c_transfer
(
client
->
adapter
,
rdwr_pa
,
rdwr_pa
,
rdwr_arg
.
nmsgs
);
rdwr_arg
.
nmsgs
);
}
}
while
(
i
--
>
0
)
while
(
i
--
>
0
)
{
{
if
(
res
>=
0
&&
(
rdwr_pa
[
i
].
flags
&
I2C_M_RD
))
if
(
res
>=
0
&&
(
rdwr_pa
[
i
].
flags
&
I2C_M_RD
))
{
{
if
(
copy_to_user
(
if
(
copy_to_user
(
...
@@ -274,20 +271,18 @@ int i2cdev_ioctl (struct inode *inode, struct file *file, unsigned int cmd,
...
@@ -274,20 +271,18 @@ 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
)
&&
(
data_arg
.
size
!=
I2C_SMBUS_BLOCK_PROC_CALL
))
{
(
data_arg
.
size
!=
I2C_SMBUS_BLOCK_PROC_CALL
))
{
#ifdef DEBUG
dev_dbg
(
&
client
->
dev
,
printk
(
KERN_DEBUG
"i2c-dev.o: size out of range (%x) in ioctl I2C_SMBUS.
\n
"
,
"size out of range (%x) in ioctl I2C_SMBUS.
\n
"
,
data_arg
.
size
);
data_arg
.
size
);
#endif
return
-
EINVAL
;
return
-
EINVAL
;
}
}
/* Note that I2C_SMBUS_READ and I2C_SMBUS_WRITE are 0 and 1,
/* Note that I2C_SMBUS_READ and I2C_SMBUS_WRITE are 0 and 1,
so the check is valid if size==I2C_SMBUS_QUICK too. */
so the check is valid if size==I2C_SMBUS_QUICK too. */
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
dev_dbg
(
&
client
->
dev
,
printk
(
KERN_DEBUG
"i2c-dev.o: read_write out of range (%x) in ioctl I2C_SMBUS.
\n
"
,
"read_write out of range (%x) in ioctl I2C_SMBUS.
\n
"
,
data_arg
.
read_write
);
data_arg
.
read_write
);
#endif
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
@@ -298,15 +293,14 @@ int i2cdev_ioctl (struct inode *inode, struct file *file, unsigned int cmd,
...
@@ -298,15 +293,14 @@ int i2cdev_ioctl (struct inode *inode, struct file *file, unsigned int cmd,
(
data_arg
.
read_write
==
I2C_SMBUS_WRITE
)))
(
data_arg
.
read_write
==
I2C_SMBUS_WRITE
)))
/* These are special: we do not use data */
/* These are special: we do not use data */
return
i2c_smbus_xfer
(
client
->
adapter
,
client
->
addr
,
return
i2c_smbus_xfer
(
client
->
adapter
,
client
->
addr
,
client
->
flags
,
client
->
flags
,
data_arg
.
read_write
,
data_arg
.
read_write
,
data_arg
.
command
,
data_arg
.
command
,
data_arg
.
size
,
NULL
);
data_arg
.
size
,
NULL
);
if
(
data_arg
.
data
==
NULL
)
{
if
(
data_arg
.
data
==
NULL
)
{
#ifdef DEBUG
dev_dbg
(
&
client
->
dev
,
printk
(
KERN_DEBUG
"i2c-dev.o: data is NULL pointer in ioctl I2C_SMBUS.
\n
"
);
"data is NULL pointer in ioctl I2C_SMBUS.
\n
"
);
#endif
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
@@ -365,7 +359,7 @@ static int i2cdev_open(struct inode *inode, struct file *file)
...
@@ -365,7 +359,7 @@ static int i2cdev_open(struct inode *inode, struct file *file)
return
0
;
return
0
;
out_kfree:
out_kfree:
kfree
(
client
);
kfree
(
client
);
return
-
ENODEV
;
return
-
ENODEV
;
}
}
...
@@ -428,7 +422,8 @@ int __init i2c_dev_init(void)
...
@@ -428,7 +422,8 @@ int __init i2c_dev_init(void)
{
{
int
res
;
int
res
;
printk
(
KERN_INFO
"i2c-dev.o: i2c /dev entries driver module version %s (%s)
\n
"
,
I2C_VERSION
,
I2C_DATE
);
printk
(
KERN_INFO
"i2c /dev entries driver module version %s (%s)
\n
"
,
I2C_VERSION
,
I2C_DATE
);
if
(
register_chrdev
(
I2C_MAJOR
,
"i2c"
,
&
i2cdev_fops
))
{
if
(
register_chrdev
(
I2C_MAJOR
,
"i2c"
,
&
i2cdev_fops
))
{
printk
(
KERN_ERR
"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
"
,
...
...
drivers/i2c/i2c-frodo.c
View file @
e605dc6c
...
@@ -59,9 +59,11 @@ static struct i2c_algo_bit_data bit_frodo_data = {
...
@@ -59,9 +59,11 @@ static struct i2c_algo_bit_data bit_frodo_data = {
static
struct
i2c_adapter
frodo_ops
=
{
static
struct
i2c_adapter
frodo_ops
=
{
.
owner
=
THIS_MODULE
,
.
owner
=
THIS_MODULE
,
.
name
=
"Frodo adapter driver"
,
.
id
=
I2C_HW_B_FRODO
,
.
id
=
I2C_HW_B_FRODO
,
.
algo_data
=
&
bit_frodo_data
,
.
algo_data
=
&
bit_frodo_data
,
.
dev
=
{
.
name
=
"Frodo adapter driver"
,
},
};
};
static
int
__init
i2c_frodo_init
(
void
)
static
int
__init
i2c_frodo_init
(
void
)
...
...
drivers/i2c/scx200_i2c.c
View file @
e605dc6c
...
@@ -82,9 +82,11 @@ static struct i2c_algo_bit_data scx200_i2c_data = {
...
@@ -82,9 +82,11 @@ static struct i2c_algo_bit_data scx200_i2c_data = {
static
struct
i2c_adapter
scx200_i2c_ops
=
{
static
struct
i2c_adapter
scx200_i2c_ops
=
{
.
owner
=
THIS_MODULE
,
.
owner
=
THIS_MODULE
,
.
name
=
"NatSemi SCx200 I2C"
,
.
id
=
I2C_HW_B_VELLE
,
.
id
=
I2C_HW_B_VELLE
,
.
algo_data
=
&
scx200_i2c_data
,
.
algo_data
=
&
scx200_i2c_data
,
.
dev
=
{
.
name
=
"NatSemi SCx200 I2C"
,
},
};
};
int
scx200_i2c_init
(
void
)
int
scx200_i2c_init
(
void
)
...
@@ -110,7 +112,7 @@ int scx200_i2c_init(void)
...
@@ -110,7 +112,7 @@ int scx200_i2c_init(void)
if
(
i2c_bit_add_bus
(
&
scx200_i2c_ops
)
<
0
)
{
if
(
i2c_bit_add_bus
(
&
scx200_i2c_ops
)
<
0
)
{
printk
(
KERN_ERR
NAME
": adapter %s registration failed
\n
"
,
printk
(
KERN_ERR
NAME
": adapter %s registration failed
\n
"
,
scx200_i2c_ops
.
name
);
scx200_i2c_ops
.
dev
.
name
);
return
-
ENODEV
;
return
-
ENODEV
;
}
}
...
...
include/linux/i2c-dev.h
View file @
e605dc6c
...
@@ -31,16 +31,16 @@
...
@@ -31,16 +31,16 @@
/* This is the structure as used in the I2C_SMBUS ioctl call */
/* This is the structure as used in the I2C_SMBUS ioctl call */
struct
i2c_smbus_ioctl_data
{
struct
i2c_smbus_ioctl_data
{
char
read_write
;
__u8
read_write
;
__u8
command
;
__u8
command
;
int
size
;
__u32
size
;
union
i2c_smbus_data
*
data
;
union
i2c_smbus_data
*
data
;
};
};
/* This is the structure as used in the I2C_RDWR ioctl call */
/* This is the structure as used in the I2C_RDWR ioctl call */
struct
i2c_rdwr_ioctl_data
{
struct
i2c_rdwr_ioctl_data
{
struct
i2c_msg
*
msgs
;
/* pointers to i2c_msgs */
struct
i2c_msg
*
msgs
;
/* pointers to i2c_msgs */
int
nmsgs
;
/* number of i2c_msgs */
__u32
nmsgs
;
/* number of i2c_msgs */
};
};
#endif
/* _LINUX_I2C_DEV_H */
#endif
/* _LINUX_I2C_DEV_H */
include/linux/i2c.h
View file @
e605dc6c
...
@@ -182,6 +182,13 @@ static inline void i2c_set_clientdata (struct i2c_client *dev, void *data)
...
@@ -182,6 +182,13 @@ static inline void i2c_set_clientdata (struct i2c_client *dev, void *data)
return
dev_set_drvdata
(
&
dev
->
dev
,
data
);
return
dev_set_drvdata
(
&
dev
->
dev
,
data
);
}
}
#define I2C_DEVNAME(str) .dev = { .name = str }
static
inline
char
*
i2c_clientname
(
struct
i2c_client
*
c
)
{
return
c
->
dev
.
name
;
}
/*
/*
* The following structs are for those who like to implement new bus drivers:
* The following structs are for those who like to implement new bus drivers:
* i2c_algorithm is the interface to a class of hardware solutions which can
* i2c_algorithm is the interface to a class of hardware solutions which can
...
@@ -360,15 +367,15 @@ extern int i2c_check_functionality (struct i2c_adapter *adap, u32 func);
...
@@ -360,15 +367,15 @@ extern int i2c_check_functionality (struct i2c_adapter *adap, u32 func);
*/
*/
struct
i2c_msg
{
struct
i2c_msg
{
__u16
addr
;
/* slave address */
__u16
addr
;
/* slave address */
unsigned
short
flags
;
__u16
flags
;
#define I2C_M_TEN 0x10
/* we have a ten bit chip address */
#define I2C_M_TEN 0x10
/* we have a ten bit chip address */
#define I2C_M_RD 0x01
#define I2C_M_RD 0x01
#define I2C_M_NOSTART 0x4000
#define I2C_M_NOSTART 0x4000
#define I2C_M_REV_DIR_ADDR 0x2000
#define I2C_M_REV_DIR_ADDR 0x2000
#define I2C_M_IGNORE_NAK 0x1000
#define I2C_M_IGNORE_NAK 0x1000
#define I2C_M_NO_RD_ACK 0x0800
#define I2C_M_NO_RD_ACK 0x0800
short
len
;
/* msg length */
__u16
len
;
/* msg length */
char
*
buf
;
/* pointer to msg data */
__u8
*
buf
;
/* pointer to msg data */
};
};
/* To determine what functionality is present */
/* To determine what functionality is present */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment