diff options
author | Amaury Pouly <amaury.pouly@gmail.com> | 2013-10-21 01:10:59 +0200 |
---|---|---|
committer | Amaury Pouly <amaury.pouly@gmail.com> | 2013-10-21 01:23:13 +0200 |
commit | 5b3eaf6f5bb9d0db0816f044323728349fadf6dd (patch) | |
tree | 477f6ae2c8adf4959e8a271ff6482d66b25b2016 /firmware/target/arm | |
parent | 6006eb59b1064cdc115583d2eab3fe7bab4ffa4d (diff) | |
download | rockbox-5b3eaf6f5bb9d0db0816f044323728349fadf6dd.tar.gz rockbox-5b3eaf6f5bb9d0db0816f044323728349fadf6dd.zip |
imx233/i2c: use 1sec timeout by default instead of blocking
These functions are mostly used by the radio drivers and any blocking
call could potentially block the entire UI, which is pretty bad.
Since any request is expected to finish within a few us, having a 10ms
timeout doesn't seem unreasonable.
Change-Id: I03b19729511547e5bbdeb3476d020e5d87d0d7e1
Diffstat (limited to 'firmware/target/arm')
-rw-r--r-- | firmware/target/arm/imx233/i2c-imx233.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/firmware/target/arm/imx233/i2c-imx233.c b/firmware/target/arm/imx233/i2c-imx233.c index 4d066a4152..ed2931269b 100644 --- a/firmware/target/arm/imx233/i2c-imx233.c +++ b/firmware/target/arm/imx233/i2c-imx233.c | |||
@@ -240,7 +240,7 @@ int i2c_write(int device, const unsigned char* buf, int count) | |||
240 | imx233_i2c_begin(); | 240 | imx233_i2c_begin(); |
241 | imx233_i2c_add(true, true, &addr, 1, false); /* start + dev addr */ | 241 | imx233_i2c_add(true, true, &addr, 1, false); /* start + dev addr */ |
242 | imx233_i2c_add(false, true, (void *)buf, count, true); /* data + stop */ | 242 | imx233_i2c_add(false, true, (void *)buf, count, true); /* data + stop */ |
243 | return imx233_i2c_end(TIMEOUT_BLOCK); | 243 | return imx233_i2c_end(1); |
244 | } | 244 | } |
245 | 245 | ||
246 | int i2c_read(int device, unsigned char* buf, int count) | 246 | int i2c_read(int device, unsigned char* buf, int count) |
@@ -249,7 +249,7 @@ int i2c_read(int device, unsigned char* buf, int count) | |||
249 | imx233_i2c_begin(); | 249 | imx233_i2c_begin(); |
250 | imx233_i2c_add(true, true, &addr, 1, false); /* start + dev addr */ | 250 | imx233_i2c_add(true, true, &addr, 1, false); /* start + dev addr */ |
251 | imx233_i2c_add(false, false, buf, count, true); /* data + stop */ | 251 | imx233_i2c_add(false, false, buf, count, true); /* data + stop */ |
252 | return imx233_i2c_end(TIMEOUT_BLOCK); | 252 | return imx233_i2c_end(1); |
253 | } | 253 | } |
254 | 254 | ||
255 | int i2c_readmem(int device, int address, unsigned char* buf, int count) | 255 | int i2c_readmem(int device, int address, unsigned char* buf, int count) |
@@ -260,7 +260,7 @@ int i2c_readmem(int device, int address, unsigned char* buf, int count) | |||
260 | imx233_i2c_add(true, true, start, 2, false); /* start + dev addr + addr */ | 260 | imx233_i2c_add(true, true, start, 2, false); /* start + dev addr + addr */ |
261 | imx233_i2c_add(true, true, &addr_rd, 1, false); /* start + dev addr */ | 261 | imx233_i2c_add(true, true, &addr_rd, 1, false); /* start + dev addr */ |
262 | imx233_i2c_add(false, false, buf, count, true); /* data + stop */ | 262 | imx233_i2c_add(false, false, buf, count, true); /* data + stop */ |
263 | return imx233_i2c_end(TIMEOUT_BLOCK); | 263 | return imx233_i2c_end(1); |
264 | } | 264 | } |
265 | 265 | ||
266 | int i2c_writemem(int device, int address, const unsigned char* buf, int count) | 266 | int i2c_writemem(int device, int address, const unsigned char* buf, int count) |
@@ -269,5 +269,5 @@ int i2c_writemem(int device, int address, const unsigned char* buf, int count) | |||
269 | imx233_i2c_begin(); | 269 | imx233_i2c_begin(); |
270 | imx233_i2c_add(true, true, start, 2, false); /* start + dev addr + addr */ | 270 | imx233_i2c_add(true, true, start, 2, false); /* start + dev addr + addr */ |
271 | imx233_i2c_add(false, true, (void *)buf, count, true); /* data + stop */ | 271 | imx233_i2c_add(false, true, (void *)buf, count, true); /* data + stop */ |
272 | return imx233_i2c_end(TIMEOUT_BLOCK); | 272 | return imx233_i2c_end(1); |
273 | } | 273 | } |