Merge branch 'i2c-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6
* 'i2c-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6: Add i2c_board_info for RiscPC PCF8583 i2c: Make sure i2c_algo_bit_data.timeout is HZ-independent i2c-dev: Clarify the unit of ioctl I2C_TIMEOUT i2c: Timeouts reach -1 i2c: Fix misplaced parentheses
This commit is contained in:
commit
21209b61b0
|
@ -19,6 +19,7 @@
|
|||
#include <linux/serial_8250.h>
|
||||
#include <linux/ata_platform.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/i2c.h>
|
||||
|
||||
#include <asm/elf.h>
|
||||
#include <asm/mach-types.h>
|
||||
|
@ -201,8 +202,13 @@ static struct platform_device *devs[] __initdata = {
|
|||
&pata_device,
|
||||
};
|
||||
|
||||
static struct i2c_board_info i2c_rtc = {
|
||||
I2C_BOARD_INFO("pcf8583", 0x50)
|
||||
};
|
||||
|
||||
static int __init rpc_init(void)
|
||||
{
|
||||
i2c_register_board_info(0, &i2c_rtc, 1);
|
||||
return platform_add_devices(devs, ARRAY_SIZE(devs));
|
||||
}
|
||||
|
||||
|
|
|
@ -79,10 +79,11 @@ static struct i2c_algo_bit_data ioc_data = {
|
|||
.getsda = ioc_getsda,
|
||||
.getscl = ioc_getscl,
|
||||
.udelay = 80,
|
||||
.timeout = 100
|
||||
.timeout = HZ,
|
||||
};
|
||||
|
||||
static struct i2c_adapter ioc_ops = {
|
||||
.nr = 0,
|
||||
.algo_data = &ioc_data,
|
||||
};
|
||||
|
||||
|
@ -90,7 +91,7 @@ static int __init i2c_ioc_init(void)
|
|||
{
|
||||
force_ones = FORCE_ONES | SCL | SDA;
|
||||
|
||||
return i2c_bit_add_bus(&ioc_ops);
|
||||
return i2c_bit_add_numbered_bus(&ioc_ops);
|
||||
}
|
||||
|
||||
module_init(i2c_ioc_init);
|
||||
|
|
|
@ -72,7 +72,7 @@ static unsigned int amd_ec_wait_write(struct amd_smbus *smbus)
|
|||
{
|
||||
int timeout = 500;
|
||||
|
||||
while (timeout-- && (inb(smbus->base + AMD_EC_SC) & AMD_EC_SC_IBF))
|
||||
while ((inb(smbus->base + AMD_EC_SC) & AMD_EC_SC_IBF) && --timeout)
|
||||
udelay(1);
|
||||
|
||||
if (!timeout) {
|
||||
|
@ -88,7 +88,7 @@ static unsigned int amd_ec_wait_read(struct amd_smbus *smbus)
|
|||
{
|
||||
int timeout = 500;
|
||||
|
||||
while (timeout-- && (~inb(smbus->base + AMD_EC_SC) & AMD_EC_SC_OBF))
|
||||
while ((~inb(smbus->base + AMD_EC_SC) & AMD_EC_SC_OBF) && --timeout)
|
||||
udelay(1);
|
||||
|
||||
if (!timeout) {
|
||||
|
|
|
@ -114,7 +114,7 @@ static int ixp2000_i2c_probe(struct platform_device *plat_dev)
|
|||
drv_data->algo_data.getsda = ixp2000_bit_getsda;
|
||||
drv_data->algo_data.getscl = ixp2000_bit_getscl;
|
||||
drv_data->algo_data.udelay = 6;
|
||||
drv_data->algo_data.timeout = 100;
|
||||
drv_data->algo_data.timeout = HZ;
|
||||
|
||||
strlcpy(drv_data->adapter.name, plat_dev->dev.driver->name,
|
||||
sizeof(drv_data->adapter.name));
|
||||
|
|
|
@ -644,7 +644,7 @@ static int i2c_pxa_do_pio_xfer(struct pxa_i2c *i2c,
|
|||
|
||||
i2c_pxa_start_message(i2c);
|
||||
|
||||
while (timeout-- && i2c->msg_num > 0) {
|
||||
while (i2c->msg_num > 0 && --timeout) {
|
||||
i2c_pxa_handler(0, i2c);
|
||||
udelay(10);
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ static struct i2c_algo_bit_data scx200_i2c_data = {
|
|||
.getsda = scx200_i2c_getsda,
|
||||
.getscl = scx200_i2c_getscl,
|
||||
.udelay = 10,
|
||||
.timeout = 100,
|
||||
.timeout = HZ,
|
||||
};
|
||||
|
||||
static struct i2c_adapter scx200_i2c_ops = {
|
||||
|
|
|
@ -1831,7 +1831,8 @@ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr,
|
|||
case I2C_SMBUS_QUICK:
|
||||
msg[0].len = 0;
|
||||
/* Special case: The read/write field is used as data */
|
||||
msg[0].flags = flags | (read_write==I2C_SMBUS_READ)?I2C_M_RD:0;
|
||||
msg[0].flags = flags | (read_write == I2C_SMBUS_READ ?
|
||||
I2C_M_RD : 0);
|
||||
num = 1;
|
||||
break;
|
||||
case I2C_SMBUS_BYTE:
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include <linux/i2c.h>
|
||||
#include <linux/i2c-dev.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/jiffies.h>
|
||||
#include <asm/uaccess.h>
|
||||
|
||||
static struct i2c_driver i2cdev_driver;
|
||||
|
@ -422,7 +423,10 @@ static long i2cdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
|||
client->adapter->retries = arg;
|
||||
break;
|
||||
case I2C_TIMEOUT:
|
||||
client->adapter->timeout = arg;
|
||||
/* For historical reasons, user-space sets the timeout
|
||||
* value in units of 10 ms.
|
||||
*/
|
||||
client->adapter->timeout = msecs_to_jiffies(arg * 10);
|
||||
break;
|
||||
default:
|
||||
/* NOTE: returning a fault code here could cause trouble
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
*/
|
||||
#define I2C_RETRIES 0x0701 /* number of times a device address should
|
||||
be polled when not acknowledging */
|
||||
#define I2C_TIMEOUT 0x0702 /* set timeout in jiffies - call with int */
|
||||
#define I2C_TIMEOUT 0x0702 /* set timeout in units of 10 ms */
|
||||
|
||||
/* NOTE: Slave address is 7 or 10 bits, but 10-bit addresses
|
||||
* are NOT supported! (due to code brokenness)
|
||||
|
|
|
@ -361,7 +361,7 @@ struct i2c_adapter {
|
|||
struct mutex bus_lock;
|
||||
struct mutex clist_lock;
|
||||
|
||||
int timeout;
|
||||
int timeout; /* in jiffies */
|
||||
int retries;
|
||||
struct device dev; /* the adapter device */
|
||||
|
||||
|
|
Loading…
Reference in New Issue