Skip to contentSkip to conversation

mpc-i2c.c in 2.6

DISCUSSION Kumar Gala 3 participants 3 messages Jan 13, 2005 – Jan 14, 2005

lore
Share & tools
lore

Kumar Gala

author
#0 lore raw

Adrian,

I was wondering if you had any opinions on the timeout between transactions in drivers/i2c/busses/mpc-i2c. Looking at it, we currently set the timeout between transactions to 1 second (HZ). Any reason its this high?

on 85xx, I'm able to set it to HZ/100 w/o any really issue.

thanks

- kumar

#1 lore raw
Quoted 5 lines · Kumar Gala

Adrian,

I was wondering if you had any opinions on the timeout between transactions in drivers/i2c/busses/mpc-i2c. Looking at it, we currently set the timeout between transactions to 1 second (HZ). Any reason its this high?

on 85xx, I'm able to set it to HZ/100 w/o any really issue.

This is just an FYI since I've been in this code recently. You can change the timeout from userspace with an ioctl. Something like this should do it:

static char *usage_msg = "Usage: set_timeout <timeout value>\n";

int main(int argc, char **argv)

{
       uint    timeout;
       int     file;

       if (argc != 2) {
               fprintf(stderr, usage_msg);
               return 1;
       }

       timeout = strtoul(argv[1], NULL, 0);

       if ((file = open("/dev/i2c/0", O_RDWR)) < 0) {
               printf("Can't open device, errno: %d (%s)\n",
                       errno, strerror(errno));
               return 1;
       }

       if (ioctl(file, I2C_TIMEOUT, &timeout) < 0) {
               printf("Can't do TIMEOUT: %s\n", strerror(errno));
               return 1;
       }

       return 0;
}
#2 lore raw
In reply to Kumar Gala
Quoted 4 lines · Kumar Gala

I was wondering if you had any opinions on the timeout between transactions in drivers/i2c/busses/mpc-i2c. Looking at it, we currently set the timeout between transactions to 1 second (HZ). Any reason its this high?

It only exists because when I started the driver I hadn't spotted the timeout field in i2c_adapter. Your patch is fine.

Signature · 1 line
Adrian Cox <[email protected]>