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
b92c617d
Commit
b92c617d
authored
Nov 18, 2004
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Plain Diff
Merge
bk://kernel.bkbits.net/gregkh/linux/i2c-2.6
into ppc970.osdl.org:/home/torvalds/v2.6/linux
parents
2f30a379
ce1061cb
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
49 additions
and
39 deletions
+49
-39
Documentation/i2c/writing-clients
Documentation/i2c/writing-clients
+16
-4
drivers/i2c/busses/Kconfig
drivers/i2c/busses/Kconfig
+1
-0
drivers/i2c/busses/i2c-amd756-s4882.c
drivers/i2c/busses/i2c-amd756-s4882.c
+5
-2
drivers/i2c/busses/i2c-nforce2.c
drivers/i2c/busses/i2c-nforce2.c
+4
-5
drivers/i2c/chips/smsc47m1.c
drivers/i2c/chips/smsc47m1.c
+21
-8
drivers/i2c/i2c-core.c
drivers/i2c/i2c-core.c
+0
-20
include/linux/pci_ids.h
include/linux/pci_ids.h
+2
-0
No files found.
Documentation/i2c/writing-clients
View file @
b92c617d
...
...
@@ -676,13 +676,25 @@ SMBus communication
extern s32 i2c_smbus_read_word_data(struct i2c_client * client, u8 command);
extern s32 i2c_smbus_write_word_data(struct i2c_client * client,
u8 command, u16 value);
extern s32 i2c_smbus_process_call(struct i2c_client * client,
u8 command, u16 value);
extern s32 i2c_smbus_write_block_data(struct i2c_client * client,
u8 command, u8 length,
u8 *values);
These ones were removed in Linux 2.6.10 because they had no users, but could
be added back later if needed:
extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client * client,
u8 command, u8 *values);
extern s32 i2c_smbus_read_block_data(struct i2c_client * client,
u8 command, u8 *values);
extern s32 i2c_smbus_write_block_data(struct i2c_client * client,
extern s32 i2c_smbus_write_
i2c_
block_data(struct i2c_client * client,
u8 command, u8 length,
u8 *values);
extern s32 i2c_smbus_process_call(struct i2c_client * client,
u8 command, u16 value);
extern s32 i2c_smbus_block_process_call(struct i2c_client *client,
u8 command, u8 length,
u8 *values)
All these transactions return -1 on failure. The 'write' transactions
return 0 on success; the 'read' transactions return the read value, except
...
...
drivers/i2c/busses/Kconfig
View file @
b92c617d
...
...
@@ -218,6 +218,7 @@ config I2C_NFORCE2
help
If you say yes to this option, support will be included for the Nvidia
Nforce2 family of mainboard I2C interfaces.
This driver also supports the nForce3 Pro 150 MCP.
This driver can also be built as a module. If so, the module
will be called i2c-nforce2.
...
...
drivers/i2c/busses/i2c-amd756-s4882.c
View file @
b92c617d
...
...
@@ -35,6 +35,7 @@
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/i2c.h>
...
...
@@ -156,7 +157,9 @@ static int __init amd756_s4882_init(void)
/* Unregister physical bus */
error
=
i2c_del_adapter
(
&
amd756_smbus
);
if
(
error
)
{
if
(
error
!=
-
EINVAL
)
if
(
error
==
-
EINVAL
)
error
=
-
ENODEV
;
else
dev_err
(
&
amd756_smbus
.
dev
,
"Physical bus removal "
"failed
\n
"
);
goto
ERROR0
;
...
...
@@ -200,7 +203,7 @@ static int __init amd756_s4882_init(void)
I2C_SMBUS_WRITE
,
0x03
,
I2C_SMBUS_BYTE_DATA
,
&
ioconfig
);
if
(
error
)
{
dev_
dbg
(
&
amd756_smbus
.
dev
,
"PCA9556 configuration failed
\n
"
);
dev_
err
(
&
amd756_smbus
.
dev
,
"PCA9556 configuration failed
\n
"
);
error
=
-
EIO
;
goto
ERROR3
;
}
...
...
drivers/i2c/busses/i2c-nforce2.c
View file @
b92c617d
/*
SMBus driver for nVidia nForce2 MCP
Added nForce3 Pro 150 Thomas Leibold <thomas@plx.com>,
Ported to 2.5 Patrick Dreker <patrick@dreker.de>,
Copyright (c) 2003 Hans-Frieder Vogt <hfvogt@arcor.de>,
Based on
...
...
@@ -25,6 +26,7 @@
/*
SUPPORTED DEVICES PCI ID
nForce2 MCP 0064
nForce3 Pro150 MCP 00D4
This driver supports the 2 SMBuses that are included in the MCP2 of the
nForce2 chipset.
...
...
@@ -49,11 +51,6 @@ MODULE_AUTHOR ("Hans-Frieder Vogt <hfvogt@arcor.de>");
MODULE_DESCRIPTION
(
"nForce2 SMBus driver"
);
#ifndef PCI_DEVICE_ID_NVIDIA_NFORCE2_SMBUS
#define PCI_DEVICE_ID_NVIDIA_NFORCE2_SMBUS 0x0064
#endif
struct
nforce2_smbus
{
struct
pci_dev
*
dev
;
struct
i2c_adapter
adapter
;
...
...
@@ -294,6 +291,8 @@ static u32 nforce2_func(struct i2c_adapter *adapter)
static
struct
pci_device_id
nforce2_ids
[]
=
{
{
PCI_VENDOR_ID_NVIDIA
,
PCI_DEVICE_ID_NVIDIA_NFORCE2_SMBUS
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
0
},
{
PCI_VENDOR_ID_NVIDIA
,
PCI_DEVICE_ID_NVIDIA_NFORCE3_SMBUS
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
0
},
{
0
}
};
...
...
drivers/i2c/chips/smsc47m1.c
View file @
b92c617d
...
...
@@ -394,6 +394,7 @@ static int smsc47m1_detect(struct i2c_adapter *adapter, int address, int kind)
struct
i2c_client
*
new_client
;
struct
smsc47m1_data
*
data
;
int
err
=
0
;
int
fan1
,
fan2
,
pwm1
,
pwm2
;
if
(
!
i2c_is_isa_adapter
(
adapter
))
{
return
0
;
...
...
@@ -423,6 +424,22 @@ static int smsc47m1_detect(struct i2c_adapter *adapter, int address, int kind)
new_client
->
id
=
smsc47m1_id
++
;
init_MUTEX
(
&
data
->
update_lock
);
/* If no function is properly configured, there's no point in
actually registering the chip. */
fan1
=
(
smsc47m1_read_value
(
new_client
,
SMSC47M1_REG_TPIN
(
0
))
&
0x05
)
==
0x05
;
fan2
=
(
smsc47m1_read_value
(
new_client
,
SMSC47M1_REG_TPIN
(
1
))
&
0x05
)
==
0x05
;
pwm1
=
(
smsc47m1_read_value
(
new_client
,
SMSC47M1_REG_PPIN
(
0
))
&
0x05
)
==
0x04
;
pwm2
=
(
smsc47m1_read_value
(
new_client
,
SMSC47M1_REG_PPIN
(
1
))
&
0x05
)
==
0x04
;
if
(
!
(
fan1
||
fan2
||
pwm1
||
pwm2
))
{
dev_warn
(
&
new_client
->
dev
,
"Device is not configured, will not use
\n
"
);
err
=
-
ENODEV
;
goto
error_free
;
}
if
((
err
=
i2c_attach_client
(
new_client
)))
goto
error_free
;
...
...
@@ -434,8 +451,7 @@ static int smsc47m1_detect(struct i2c_adapter *adapter, int address, int kind)
function. */
smsc47m1_update_device
(
&
new_client
->
dev
,
1
);
if
((
smsc47m1_read_value
(
new_client
,
SMSC47M1_REG_TPIN
(
0
))
&
0x05
)
==
0x05
)
{
if
(
fan1
)
{
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_fan1_input
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_fan1_min
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_fan1_div
);
...
...
@@ -443,8 +459,7 @@ static int smsc47m1_detect(struct i2c_adapter *adapter, int address, int kind)
dev_dbg
(
&
new_client
->
dev
,
"Fan 1 not enabled by hardware, "
"skipping
\n
"
);
if
((
smsc47m1_read_value
(
new_client
,
SMSC47M1_REG_TPIN
(
1
))
&
0x05
)
==
0x05
)
{
if
(
fan2
)
{
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_fan2_input
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_fan2_min
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_fan2_div
);
...
...
@@ -452,15 +467,13 @@ static int smsc47m1_detect(struct i2c_adapter *adapter, int address, int kind)
dev_dbg
(
&
new_client
->
dev
,
"Fan 2 not enabled by hardware, "
"skipping
\n
"
);
if
((
smsc47m1_read_value
(
new_client
,
SMSC47M1_REG_PPIN
(
0
))
&
0x05
)
==
0x04
)
{
if
(
pwm1
)
{
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_pwm1
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_pwm1_enable
);
}
else
dev_dbg
(
&
new_client
->
dev
,
"PWM 1 not enabled by hardware, "
"skipping
\n
"
);
if
((
smsc47m1_read_value
(
new_client
,
SMSC47M1_REG_PPIN
(
1
))
&
0x05
)
==
0x04
)
{
if
(
pwm2
)
{
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_pwm2
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_pwm2_enable
);
}
else
...
...
drivers/i2c/i2c-core.c
View file @
b92c617d
...
...
@@ -1021,7 +1021,6 @@ s32 i2c_smbus_write_word_data(struct i2c_client *client, u8 command, u16 value)
I2C_SMBUS_WORD_DATA
,
&
data
);
}
/* Returns the number of bytes transferred */
s32
i2c_smbus_write_block_data
(
struct
i2c_client
*
client
,
u8
command
,
u8
length
,
u8
*
values
)
{
...
...
@@ -1037,25 +1036,6 @@ s32 i2c_smbus_write_block_data(struct i2c_client *client, u8 command,
I2C_SMBUS_BLOCK_DATA
,
&
data
);
}
/* Returns the number of read bytes */
s32
i2c_smbus_block_process_call
(
struct
i2c_client
*
client
,
u8
command
,
u8
length
,
u8
*
values
)
{
union
i2c_smbus_data
data
;
int
i
;
if
(
length
>
I2C_SMBUS_BLOCK_MAX
-
1
)
return
-
1
;
data
.
block
[
0
]
=
length
;
for
(
i
=
1
;
i
<=
length
;
i
++
)
data
.
block
[
i
]
=
values
[
i
-
1
];
if
(
i2c_smbus_xfer
(
client
->
adapter
,
client
->
addr
,
client
->
flags
,
I2C_SMBUS_WRITE
,
command
,
I2C_SMBUS_BLOCK_PROC_CALL
,
&
data
))
return
-
1
;
for
(
i
=
1
;
i
<=
data
.
block
[
0
];
i
++
)
values
[
i
-
1
]
=
data
.
block
[
i
];
return
data
.
block
[
0
];
}
/* Returns the number of read bytes */
s32
i2c_smbus_read_i2c_block_data
(
struct
i2c_client
*
client
,
u8
command
,
u8
*
values
)
{
...
...
include/linux/pci_ids.h
View file @
b92c617d
...
...
@@ -1082,6 +1082,7 @@
#define PCI_DEVICE_ID_NVIDIA_NVENET_8 0x0056
#define PCI_DEVICE_ID_NVIDIA_NVENET_9 0x0057
#define PCI_DEVICE_ID_NVIDIA_CK804_AUDIO 0x0059
#define PCI_DEVICE_ID_NVIDIA_NFORCE2_SMBUS 0x0064
#define PCI_DEVICE_ID_NVIDIA_NFORCE2_IDE 0x0065
#define PCI_DEVICE_ID_NVIDIA_NVENET_2 0x0066
#define PCI_DEVICE_ID_NVIDIA_MCP2_AUDIO 0x006a
...
...
@@ -1093,6 +1094,7 @@
#define PCI_DEVICE_ID_NVIDIA_NFORCE3 0x00d1
#define PCI_DEVICE_ID_NVIDIA_MCP3_AUDIO 0x00da
#define PCI_DEVICE_ID_NVIDIA_NFORCE3S 0x00e1
#define PCI_DEVICE_ID_NVIDIA_NFORCE3_SMBUS 0x00d4
#define PCI_DEVICE_ID_NVIDIA_NFORCE3_IDE 0x00d5
#define PCI_DEVICE_ID_NVIDIA_NVENET_3 0x00d6
#define PCI_DEVICE_ID_NVIDIA_MCP3_AUDIO 0x00da
...
...
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