i2c: designware: Enable ioctl I2C_TIMEOUT
Subsystems (3)
PATCH 1/1 i2c: designware: Enable ioctl I2C_TIMEOUT
This allows applications to set the transfer timeout in 10ms increments via ioctl I2C_TIMEOUT.
--- drivers/i2c/busses/i2c-designware-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-designware-core.c +1 -1
@@ -663,7 +663,7 @@ i2c_dw_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)i2c_dw_xfer_init (dev);/* wait for tx to complete */ -if (!wait_for_completion_timeout (&dev->cmd_complete,HZ )) { +if (!wait_for_completion_timeout (&dev->cmd_complete, adap->timeout)) {dev_err (dev->dev,"controller timed out\n" );/* i2c_dw_init implicitly disables the adapter */ i2c_dw_init (dev);
Signature · 1 line
1.9.1
Quoted 2 lines · Weifeng Voon
This allows applications to set the transfer timeout in 10ms increments via ioctl
I2C_TIMEOUT.
10ms is only correct with HZ=100. With higher values of HZ you get a finer resolution. I'd write:
Respect the transfer timeout set via the I2C_TIMEOUT ioctl.
and not mention the resolution at all. After all your patch doesn't "enable" that ioctl, just makes use of the value set by it.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
Quoted 10 lines
From: Uwe Kleine-König [mailto:[email protected]]
Quoted 2 lines · Weifeng Voon
This allows applications to set the transfer timeout in 10ms increments via ioctl
I2C_TIMEOUT.10ms is only correct with HZ=100. With higher values of HZ you get a finer resolution. I'd write:
Respect the transfer timeout set via the
I2C_TIMEOUTioctl.
10ms is correct and regardless of HZ.
From i2c-dev.c:client->adapter->timeout = msecs_to_jiffies(arg * 10);
The purpose of putting in the resolution of 10ms is just for the ease of others when they are using this patch. I am ok to take it out if it is not necessary.
Quoted 2 lines
and not mention the resolution at all. After all your patch doesn't "enable" that ioctl, just makes use of the value set by it.
Yes, you are right. I am just using the value set by it. Maybe this may sounds more relevant:
Set transfer timeout via ioctl I2C_TIMEOUT
Or any other recommendation?
Quoted 8 lines
Best regards
Uwe--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Quoted 1 line
Set transfer timeout via ioctl
I2C_TIMEOUT
"Use transfer timeout from ioctl I2C_TIMEOUT"
?