Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 117176
b: refs/heads/master
c: 3009140
h: refs/heads/master
v: v3
  • Loading branch information
David Miller authored and Jean Delvare committed Oct 22, 2008
1 parent 013176c commit fbd570c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 08e5338d119daeb3c7746fa80fa916b8d3d48e89
refs/heads/master: 30091404af5a7cd515e7b565df76932e295d8f6f
17 changes: 13 additions & 4 deletions trunk/drivers/i2c/algos/i2c-algo-pcf.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,13 +331,16 @@ static int pcf_xfer(struct i2c_adapter *i2c_adap,
int i;
int ret=0, timeout, status;

if (adap->xfer_begin)
adap->xfer_begin(adap->data);

/* Check for bus busy */
timeout = wait_for_bb(adap);
if (timeout) {
DEB2(printk(KERN_ERR "i2c-algo-pcf.o: "
"Timeout waiting for BB in pcf_xfer\n");)
return -EIO;
i = -EIO;
goto out;
}

for (i = 0;ret >= 0 && i < num; i++) {
Expand All @@ -359,20 +362,23 @@ static int pcf_xfer(struct i2c_adapter *i2c_adap,
if (timeout) {
if (timeout == -EINTR) {
/* arbitration lost */
return (-EINTR);
i = -EINTR;
goto out;
}
i2c_stop(adap);
DEB2(printk(KERN_ERR "i2c-algo-pcf.o: Timeout waiting "
"for PIN(1) in pcf_xfer\n");)
return (-EREMOTEIO);
i = -EREMOTEIO;
goto out;
}

#ifndef STUB_I2C
/* Check LRB (last rcvd bit - slave ack) */
if (status & I2C_PCF_LRB) {
i2c_stop(adap);
DEB2(printk(KERN_ERR "i2c-algo-pcf.o: No LRB(1) in pcf_xfer\n");)
return (-EREMOTEIO);
i = -EREMOTEIO;
goto out;
}
#endif

Expand Down Expand Up @@ -404,6 +410,9 @@ static int pcf_xfer(struct i2c_adapter *i2c_adap,
}
}

out:
if (adap->xfer_end)
adap->xfer_end(adap->data);
return (i);
}

Expand Down
3 changes: 3 additions & 0 deletions trunk/include/linux/i2c-algo-pcf.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ struct i2c_algo_pcf_data {
int (*getclock) (void *data);
void (*waitforpin) (void *data);

void (*xfer_begin) (void *data);
void (*xfer_end) (void *data);

/* Multi-master lost arbitration back-off delay (msecs)
* This should be set by the bus adapter or knowledgable client
* if bus is multi-mastered, else zero
Expand Down

0 comments on commit fbd570c

Please sign in to comment.