From 5b3eaf6f5bb9d0db0816f044323728349fadf6dd Mon Sep 17 00:00:00 2001 From: Amaury Pouly Date: Mon, 21 Oct 2013 01:10:59 +0200 Subject: 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 --- firmware/target/arm/imx233/i2c-imx233.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'firmware') 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) imx233_i2c_begin(); imx233_i2c_add(true, true, &addr, 1, false); /* start + dev addr */ imx233_i2c_add(false, true, (void *)buf, count, true); /* data + stop */ - return imx233_i2c_end(TIMEOUT_BLOCK); + return imx233_i2c_end(1); } int i2c_read(int device, unsigned char* buf, int count) @@ -249,7 +249,7 @@ int i2c_read(int device, unsigned char* buf, int count) imx233_i2c_begin(); imx233_i2c_add(true, true, &addr, 1, false); /* start + dev addr */ imx233_i2c_add(false, false, buf, count, true); /* data + stop */ - return imx233_i2c_end(TIMEOUT_BLOCK); + return imx233_i2c_end(1); } 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) imx233_i2c_add(true, true, start, 2, false); /* start + dev addr + addr */ imx233_i2c_add(true, true, &addr_rd, 1, false); /* start + dev addr */ imx233_i2c_add(false, false, buf, count, true); /* data + stop */ - return imx233_i2c_end(TIMEOUT_BLOCK); + return imx233_i2c_end(1); } 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) imx233_i2c_begin(); imx233_i2c_add(true, true, start, 2, false); /* start + dev addr + addr */ imx233_i2c_add(false, true, (void *)buf, count, true); /* data + stop */ - return imx233_i2c_end(TIMEOUT_BLOCK); + return imx233_i2c_end(1); } -- cgit v1.2.3