Commit b92c617d authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://kernel.bkbits.net/gregkh/linux/i2c-2.6

into ppc970.osdl.org:/home/torvalds/v2.6/linux
parents 2f30a379 ce1061cb
...@@ -676,13 +676,25 @@ SMBus communication ...@@ -676,13 +676,25 @@ SMBus communication
extern s32 i2c_smbus_read_word_data(struct i2c_client * client, u8 command); extern s32 i2c_smbus_read_word_data(struct i2c_client * client, u8 command);
extern s32 i2c_smbus_write_word_data(struct i2c_client * client, extern s32 i2c_smbus_write_word_data(struct i2c_client * client,
u8 command, u16 value); u8 command, u16 value);
extern s32 i2c_smbus_process_call(struct i2c_client * client, extern s32 i2c_smbus_write_block_data(struct i2c_client * client,
u8 command, u16 value); 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, extern s32 i2c_smbus_read_block_data(struct i2c_client * client,
u8 command, u8 *values); 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 command, u8 length,
u8 *values); 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 All these transactions return -1 on failure. The 'write' transactions
return 0 on success; the 'read' transactions return the read value, except return 0 on success; the 'read' transactions return the read value, except
......
...@@ -218,6 +218,7 @@ config I2C_NFORCE2 ...@@ -218,6 +218,7 @@ config I2C_NFORCE2
help help
If you say yes to this option, support will be included for the Nvidia If you say yes to this option, support will be included for the Nvidia
Nforce2 family of mainboard I2C interfaces. 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 This driver can also be built as a module. If so, the module
will be called i2c-nforce2. will be called i2c-nforce2.
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/i2c.h> #include <linux/i2c.h>
...@@ -156,7 +157,9 @@ static int __init amd756_s4882_init(void) ...@@ -156,7 +157,9 @@ static int __init amd756_s4882_init(void)
/* Unregister physical bus */ /* Unregister physical bus */
error = i2c_del_adapter(&amd756_smbus); error = i2c_del_adapter(&amd756_smbus);
if (error) { if (error) {
if (error != -EINVAL) if (error == -EINVAL)
error = -ENODEV;
else
dev_err(&amd756_smbus.dev, "Physical bus removal " dev_err(&amd756_smbus.dev, "Physical bus removal "
"failed\n"); "failed\n");
goto ERROR0; goto ERROR0;
...@@ -200,7 +203,7 @@ static int __init amd756_s4882_init(void) ...@@ -200,7 +203,7 @@ static int __init amd756_s4882_init(void)
I2C_SMBUS_WRITE, 0x03, I2C_SMBUS_WRITE, 0x03,
I2C_SMBUS_BYTE_DATA, &ioconfig); I2C_SMBUS_BYTE_DATA, &ioconfig);
if (error) { if (error) {
dev_dbg(&amd756_smbus.dev, "PCA9556 configuration failed\n"); dev_err(&amd756_smbus.dev, "PCA9556 configuration failed\n");
error = -EIO; error = -EIO;
goto ERROR3; goto ERROR3;
} }
......
/* /*
SMBus driver for nVidia nForce2 MCP SMBus driver for nVidia nForce2 MCP
Added nForce3 Pro 150 Thomas Leibold <thomas@plx.com>,
Ported to 2.5 Patrick Dreker <patrick@dreker.de>, Ported to 2.5 Patrick Dreker <patrick@dreker.de>,
Copyright (c) 2003 Hans-Frieder Vogt <hfvogt@arcor.de>, Copyright (c) 2003 Hans-Frieder Vogt <hfvogt@arcor.de>,
Based on Based on
...@@ -25,6 +26,7 @@ ...@@ -25,6 +26,7 @@
/* /*
SUPPORTED DEVICES PCI ID SUPPORTED DEVICES PCI ID
nForce2 MCP 0064 nForce2 MCP 0064
nForce3 Pro150 MCP 00D4
This driver supports the 2 SMBuses that are included in the MCP2 of the This driver supports the 2 SMBuses that are included in the MCP2 of the
nForce2 chipset. nForce2 chipset.
...@@ -49,11 +51,6 @@ MODULE_AUTHOR ("Hans-Frieder Vogt <hfvogt@arcor.de>"); ...@@ -49,11 +51,6 @@ MODULE_AUTHOR ("Hans-Frieder Vogt <hfvogt@arcor.de>");
MODULE_DESCRIPTION("nForce2 SMBus driver"); 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 nforce2_smbus {
struct pci_dev *dev; struct pci_dev *dev;
struct i2c_adapter adapter; struct i2c_adapter adapter;
...@@ -294,6 +291,8 @@ static u32 nforce2_func(struct i2c_adapter *adapter) ...@@ -294,6 +291,8 @@ static u32 nforce2_func(struct i2c_adapter *adapter)
static struct pci_device_id nforce2_ids[] = { static struct pci_device_id nforce2_ids[] = {
{ PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2_SMBUS, { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2_SMBUS,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, 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 } { 0 }
}; };
......
...@@ -394,6 +394,7 @@ static int smsc47m1_detect(struct i2c_adapter *adapter, int address, int kind) ...@@ -394,6 +394,7 @@ static int smsc47m1_detect(struct i2c_adapter *adapter, int address, int kind)
struct i2c_client *new_client; struct i2c_client *new_client;
struct smsc47m1_data *data; struct smsc47m1_data *data;
int err = 0; int err = 0;
int fan1, fan2, pwm1, pwm2;
if (!i2c_is_isa_adapter(adapter)) { if (!i2c_is_isa_adapter(adapter)) {
return 0; return 0;
...@@ -423,6 +424,22 @@ static int smsc47m1_detect(struct i2c_adapter *adapter, int address, int kind) ...@@ -423,6 +424,22 @@ static int smsc47m1_detect(struct i2c_adapter *adapter, int address, int kind)
new_client->id = smsc47m1_id++; new_client->id = smsc47m1_id++;
init_MUTEX(&data->update_lock); 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))) if ((err = i2c_attach_client(new_client)))
goto error_free; goto error_free;
...@@ -434,8 +451,7 @@ static int smsc47m1_detect(struct i2c_adapter *adapter, int address, int kind) ...@@ -434,8 +451,7 @@ static int smsc47m1_detect(struct i2c_adapter *adapter, int address, int kind)
function. */ function. */
smsc47m1_update_device(&new_client->dev, 1); smsc47m1_update_device(&new_client->dev, 1);
if ((smsc47m1_read_value(new_client, SMSC47M1_REG_TPIN(0)) & 0x05) if (fan1) {
== 0x05) {
device_create_file(&new_client->dev, &dev_attr_fan1_input); 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_min);
device_create_file(&new_client->dev, &dev_attr_fan1_div); 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) ...@@ -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, " dev_dbg(&new_client->dev, "Fan 1 not enabled by hardware, "
"skipping\n"); "skipping\n");
if ((smsc47m1_read_value(new_client, SMSC47M1_REG_TPIN(1)) & 0x05) if (fan2) {
== 0x05) {
device_create_file(&new_client->dev, &dev_attr_fan2_input); 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_min);
device_create_file(&new_client->dev, &dev_attr_fan2_div); 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) ...@@ -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, " dev_dbg(&new_client->dev, "Fan 2 not enabled by hardware, "
"skipping\n"); "skipping\n");
if ((smsc47m1_read_value(new_client, SMSC47M1_REG_PPIN(0)) & 0x05) if (pwm1) {
== 0x04) {
device_create_file(&new_client->dev, &dev_attr_pwm1); device_create_file(&new_client->dev, &dev_attr_pwm1);
device_create_file(&new_client->dev, &dev_attr_pwm1_enable); device_create_file(&new_client->dev, &dev_attr_pwm1_enable);
} else } else
dev_dbg(&new_client->dev, "PWM 1 not enabled by hardware, " dev_dbg(&new_client->dev, "PWM 1 not enabled by hardware, "
"skipping\n"); "skipping\n");
if ((smsc47m1_read_value(new_client, SMSC47M1_REG_PPIN(1)) & 0x05) if (pwm2) {
== 0x04) {
device_create_file(&new_client->dev, &dev_attr_pwm2); device_create_file(&new_client->dev, &dev_attr_pwm2);
device_create_file(&new_client->dev, &dev_attr_pwm2_enable); device_create_file(&new_client->dev, &dev_attr_pwm2_enable);
} else } else
......
...@@ -1021,7 +1021,6 @@ s32 i2c_smbus_write_word_data(struct i2c_client *client, u8 command, u16 value) ...@@ -1021,7 +1021,6 @@ s32 i2c_smbus_write_word_data(struct i2c_client *client, u8 command, u16 value)
I2C_SMBUS_WORD_DATA,&data); I2C_SMBUS_WORD_DATA,&data);
} }
/* Returns the number of bytes transferred */
s32 i2c_smbus_write_block_data(struct i2c_client *client, u8 command, s32 i2c_smbus_write_block_data(struct i2c_client *client, u8 command,
u8 length, u8 *values) u8 length, u8 *values)
{ {
...@@ -1037,25 +1036,6 @@ s32 i2c_smbus_write_block_data(struct i2c_client *client, u8 command, ...@@ -1037,25 +1036,6 @@ s32 i2c_smbus_write_block_data(struct i2c_client *client, u8 command,
I2C_SMBUS_BLOCK_DATA,&data); 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 */ /* Returns the number of read bytes */
s32 i2c_smbus_read_i2c_block_data(struct i2c_client *client, u8 command, u8 *values) s32 i2c_smbus_read_i2c_block_data(struct i2c_client *client, u8 command, u8 *values)
{ {
......
...@@ -1082,6 +1082,7 @@ ...@@ -1082,6 +1082,7 @@
#define PCI_DEVICE_ID_NVIDIA_NVENET_8 0x0056 #define PCI_DEVICE_ID_NVIDIA_NVENET_8 0x0056
#define PCI_DEVICE_ID_NVIDIA_NVENET_9 0x0057 #define PCI_DEVICE_ID_NVIDIA_NVENET_9 0x0057
#define PCI_DEVICE_ID_NVIDIA_CK804_AUDIO 0x0059 #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_NFORCE2_IDE 0x0065
#define PCI_DEVICE_ID_NVIDIA_NVENET_2 0x0066 #define PCI_DEVICE_ID_NVIDIA_NVENET_2 0x0066
#define PCI_DEVICE_ID_NVIDIA_MCP2_AUDIO 0x006a #define PCI_DEVICE_ID_NVIDIA_MCP2_AUDIO 0x006a
...@@ -1093,6 +1094,7 @@ ...@@ -1093,6 +1094,7 @@
#define PCI_DEVICE_ID_NVIDIA_NFORCE3 0x00d1 #define PCI_DEVICE_ID_NVIDIA_NFORCE3 0x00d1
#define PCI_DEVICE_ID_NVIDIA_MCP3_AUDIO 0x00da #define PCI_DEVICE_ID_NVIDIA_MCP3_AUDIO 0x00da
#define PCI_DEVICE_ID_NVIDIA_NFORCE3S 0x00e1 #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_NFORCE3_IDE 0x00d5
#define PCI_DEVICE_ID_NVIDIA_NVENET_3 0x00d6 #define PCI_DEVICE_ID_NVIDIA_NVENET_3 0x00d6
#define PCI_DEVICE_ID_NVIDIA_MCP3_AUDIO 0x00da #define PCI_DEVICE_ID_NVIDIA_MCP3_AUDIO 0x00da
......
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